﻿@model IEnumerable<EquipManagement.Models.Equipment>
@{
    ViewBag.Title = "仪器浏览";
}
<h2>仪器浏览</h2>
<div>
    <form class="form-inline" method="get">
        <div class="form-group">
            <label>
                仪器名
            </label>
            <input name="name" class="form-control" value="@Request.Params["Name"]" />
        </div>
        <div class="form-group">
            <label>仪器类型</label>
            @Html.DropDownList("EquipmentTypeId", null, "---请选择---", new { @class = "form-control" })
        </div>
        <div class="form-group">
            <label class="control-label">所有人</label>
            @Html.DropDownList("OwnerId", null, "---请选择---", new { @class = "form-control" })
        </div>
        <div class="form-group">
            <label class="control-label">未使用</label>
            <input type="checkbox" name="Status" checked="@Request.Params["Status"]" />
        </div>
        <button class="btn btn-primary" type="submit">查找</button>
    </form>
</div>
<table class="table table-striped">
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.Name)
            </th>
            <th>
                类型
            </th>
            <th>
                所有人
            </th>
            <th>状态</th>
            <th>详情</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    <span>@item.Name</span>
                </td>
                <td>
                    @item.Type.Name
                </td>
                <td>
                    @item.Owner.Name
                </td>
                <td>
                    @Html.DisplayFor(model => item.Status)

                </td>
                <td>
                    @Html.ActionLink("详情", "Details", "Equipments", new { id = item.Id }, new { })
                </td>
                <td>
                    @if (!item.Status)
                    {
                        @Html.ActionLink("申请", "Create", "ApplicationRecords", new { id = item.Id }, new { })
                    }
                </td>
            </tr>
        }
    </tbody>
</table>
